<template>
    <div class="box">
        <Button type="warning" class="header" target="_blank" to='http://10.40.3.151:36472/wl/runTick?ip=10.40.3.151'>启动10.40.3.151服务器</Button>
        <Button type="warning" class="header" target="_blank" to='http://10.40.3.152:36472/wl/runTick?ip=10.40.3.152'>启动10.40.3.152服务器</Button>
        <Button type="warning" class="header" target="_blank" to='http://10.40.3.153:36472/wl/runTick?ip=10.40.3.153'>启动10.40.3.153服务器</Button>
        <div class="card" v-for="(item,index) in allData" :key="index" :value="item">
            <h3>服务器ip：{{index}}</h3>
                <div class="kapian">
                    <card style="width: 320px" v-for="(item2,index2) in item" :key="index2" :value="item2">
                        <p>执行间隔：{{index2}}</p>
                        <p>任务名称：{{item2.desc}}</p>
                        <p>运行次数：{{item2.runNum}}</p>
<!--                        <h3>tick：{{item2.tick}}</h3>-->
                        <p>最后运行时间：{{item2.lastRunTime}}</p>
                    </card>
                </div>
        </div>
    </div>
</template>

<script>
import { getState } from '@/api/swoole'

export default {
  data () {
    return {
      allData: []
    }
  },
  methods: {
    init () {
      getState().then(ret => {
        let data = ret.data
        if (data.errcode === 200) {
          this.allData = data.data
          console.log(this.allData, '我是谁')
        } else {
          this.error(data)
        }
      })
    }
  },
  mounted () {
    this.init()
  }
}
</script>

<style scoped>
    .ivu-form-item {
        margin-bottom: 0;
    }

    .box {
        margin-bottom: 50px;
    }
    .card{
        margin-top: 20px;
    }
    .kapian{
        display: flex;
        justify-content: space-between;
    }
    .header{
        margin-right: 20px;
    }
</style>
